package EnmuDemo;

public enum TestEnum {
    BLACK(0,"black"),RED(1,"red"),WHITE(2,"white"),GREEN(3,"green");
    public int ordinal;
    public String color;

    private TestEnum(int ordinal, String color) {
        this.ordinal = ordinal;
        this.color = color;
    }

    public static void main(String[] args) {
        TestEnum[] testEnums = TestEnum.values();
        for(int i = 0;i<testEnums.length;i++){
            System.out.println(testEnums[i] +" "+testEnums[i].ordinal());
        }
        TestEnum testEnum = TestEnum.valueOf("WHITE");
        System.out.println(testEnum);
        System.out.println(WHITE.compareTo(BLACK));

    }
    public static void main1(String[] args) {
        TestEnum testEnum = RED;
        switch (testEnum){
            case RED :
                System.out.println("RED");
                break;
            case BLACK:
                System.out.println("BLACK");
                break;
            case GREEN:
                System.out.println("GREEN");
                break;
            case WHITE:
                System.out.println("WHITE");
                break;
        }
    }
}
